package com.crayon.account.fragments.ui;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.crayon.account.data.ENMapKey;
import com.crayon.sharemenu.R;
import com.crayon.util.UIBIND;
import com.crayon.util.UTILCurrency;
import com.crayon.util.UTILDate;

import java.util.Date;
import java.util.HashMap;

/**
 * com.crayon.account.fragments.FragmentTopSum
 * @author kws
 *
 */
public class FragmentTopSum extends Fragment {


	public static FragmentTopSum onCreateInstance(long time){
		FragmentTopSum f = new FragmentTopSum();
		return f;
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		return inflater.inflate(R.layout.fragment_topsum_layout, null, false);
	}
	
	public void bindTextData(HashMap<ENMapKey, Object> hash){
		Date monthOfStart = new Date((Long) hash.get(ENMapKey.DATE_START));
		UIBIND.bindText(getView(), R.id.textTopMonth,String.format("%s%s",  UTILDate.getMM(monthOfStart),getString(R.string.text_month)));
		UIBIND.bindText(getView(), R.id.textTopTotal, UTILCurrency.formatWonPrice((Long)hash.get(ENMapKey.TOTALSUMMARY)));
		UIBIND.bindText(getView(), R.id.textTopIncom, UTILCurrency.formatWonPrice((Long)hash.get(ENMapKey.TOTALINCOM)));
		UIBIND.bindText(getView(), R.id.textTopOutCom, UTILCurrency.formatWonPrice((Long)hash.get(ENMapKey.TOTALOUTCOM)));
	}

		
}
